<template>
	<view style="background-color: #f4f4f4; width:  100%; height: 800px;">
		  <u-sticky bgColor="#fff">
		    <u-tabs ref="tabs"  :list="list1" @change="tabschange" itemStyle="width:20%; height:40px"></u-tabs>
		  </u-sticky>
		  <div style="height: 10px;"></div>
		  <view class="body"  v-for="a in orderlist" :key="a.id">
			  <u-row>
				  <u-col span=8 style="margin-left: 15px; margin-top: 8px;">订单编号：156156456421</u-col>
				  <u-col span=4 style="color: #d7000f; margin-top: 5px;">{{a.orderFlag == 1?'待付款': a.orderFlag == 2?'待发货': (a.orderFlag == 2 ? '待收货' : '')}}</u-col>
			  </u-row>
			  <u-divider text=""></u-divider>
			<u-row style="margin-top: -15px;">
				<u-col span=4>
				<u--image class="image1" radius="10" width ="100px"  shape="filleted" height="110px"  :src="'http://101.43.223.224:8765/image/getImageById?id='+a.imageid"  ></u--image>		
				</u-col>
				<u-col span=6>
					<view style=" width: 100%; height: 30px; margin-bottom: 35px; "><p class="p1">{{a.productName}}</p></view>
						<view style="float: left; width: 100%; height: 30px; ">
							<p  style=" font-size: 13px;  margin-top: -10px;">成功拍下时间：2022-10-27</p>
						<p style="margin-top: 10px; margin-left: 5px;">x 1</p>
						</view>			
				</u-col>
			</u-row>
			  <u-divider text=""></u-divider>
			  	<p  style="float: left; color: red; font-size: 18px; margin-top: 5px; margin-left: 20px;">￥123</p>
			  <u-button type="error" shape="circle" :plain="true" @click="orderdetails(a.id)" text="确认付款" style="height: 40px; width: 80px; float: right;  margin-right: 20px;" v-if="a.orderFlag==1"></u-button>
			  <u-button type="error" shape="circle" :plain="true" text="提醒发货" style="height: 40px; width: 80px; float: right; margin-right: 20px;" v-if="a.orderFlag==2"></u-button>
			<u-button type="error" shape="circle" :plain="true"text="确认收货" style="height: 40px; width: 80px; float: right; margin-right: 20px;" v-if="a.orderFlag==3"></u-button>
		  </view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id:1,
				index:null,
				orderlist:[{
					id: 1, //id
					orderFlag:'', //订单状态1 待付款 2待发货 3 待收货
					productId:'', //商品id
					productName:'',//商品名称
					quantity:'', //数量
					startingPrice:'',//起拍价
					transactionPrice:'',//成交价
					earnestMoney:'',//保证金
					durationOfBidding:'', //竞拍时间
					commissionRate:'', //佣金比例
					deliveryType:'', //交货方式
					deliveryPoints:'', //交货地点
					addressId:'', //地址id
					clientAddress:'',
					orderNumber:'',//订单编号
					transactionTotal:'', //订单总价
					strikeTime:'', //付款时间
				}],
			src:'/static/yc.jpg',
			list1: [{
						name: '全部订单',
					}, {
						name: '待付款',
					}, {
						name: '待发货'
					},
					{
						name: '待收货'
					},
					]
			}
		},
		mounted () {
				var userId = uni.getStorageSync("loginId")
				if(userId){
				    this.id = userId
				} 
			if(this.index){
				this.$refs.tabs.innerCurrent = this.index
				this.listOrder( this.index) //订单单查
			}else{
				
		  this.listOrder() //订单单查
			}
		  console.log(this.$refs.tabs)
		  
		},
		onLoad: function(option) {
				 
		// 获取上一页面传输过来的参数
		    this.index = option.index
		 console.log("aaa"+this.index)
		   },
		methods: {
			tabschange(index){
				console.log(index)
				if(index.index==0){
				this.listOrder()
				}else {
					this.listOrder(index.index)
				}
				console.log(this.$refs.tabs)
				},
			listOrder(a){
				var str = ""
				if(a!=undefined){
					str = "&orderFlag="+a
				}
				var that=this
				uni.request({
						url: "http://"+that.$host+":"+that.$port+"/order/orderListInfo?bidder="+that.id+str,                
						method: 'GET',
						dataType: 'json',
						data:{bidder : that.id},
						success: (res) => {
						this.orderlist = res.data.obj
						console.log(this.orderlist.lenght)
						this.orderlist.forEach(function(a){
						})
							},                  	
						});
			},
				click(item) {
			     console.log('item', item);
			            },
				orderdetails(id){
					uni.navigateTo({
						url:'/pages/mine/orderdetails/orderdetails?id='+ id
					})
				}
		}
	}
</script>

<style>
.body{
	width: 95%;
	height: 255px;
	margin: 0 auto;
	border-radius:15px;
	margin-top: 10px;
	background-color: #fff;
}
.image1{
	margin-top: 10px;
	border-radius: 10px,10px;
	margin-left: 10px;
	/* float: left; */
}
.p1{
	font-size: 16px;
	font-weight: 400;
}
.p2{
		font-size: 12px;
}
</style>
